// Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef CLOUDAPPENGINE_CAECOMMON_H
#define CLOUDAPPENGINE_CAECOMMON_H

#include <string>
#include <vector>

class CaeCommon {
public:
    CaeCommon();
    ~CaeCommon();

    static void PrintfCurrentTime(const std::string &logInfo);

    static std::string ToUTCTime(time_t mTime);

    static std::string To24Hour(time_t mTime);

    static std::string ToLowerCaseStr(std::string str);

    static std::string ToISO8601Time(time_t &time);

    static uint32_t StrToUInt32(const char *key, const char *value, uint32_t defaultValue);

    static time_t GetCurrentTimestamp();

    static bool IsFileExist(const std::string &name);

    static std::string ReadFileToString(const std::string &fileName);

    static int CompareVersion(const std::string &version1, const std::string &version2);
};

#endif // CLOUDAPPENGINE_CAECOMMON_H
